module PC_Incrementer(pc_in, icode, valC, Bch, icode_m, valM, finished, pc_out);
input [31:0] pc_in;
input [3:0] icode;
input [31:0] valC;
input Bch;
input [3:0] icode_m;
input [31:0] valM;
input finished;

output reg [31:0] pc_out;

always @(*) begin
	if(icode_m == 9) begin
		pc_out <= valM;
	end else if((finished && icode == 8) || (finished && icode == 7 && Bch)) begin
		pc_out <= valC;
	end else if(finished && (icode == 0 || icode == 1 || icode == 7 || icode == 8 || icode == 9 || icode == 12)) begin
		pc_out <= pc_in + 1;
	end else if(finished && !(icode == 0 || icode == 1 || icode == 7 || icode == 8 || icode == 9 || icode == 12) && pc_in[0]) begin
		pc_out <= pc_in;
	end else begin
		pc_out <= pc_in + 2;
	end
end

endmodule